<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html PUBLIC "-//W3C//Ddiv HTML 4.01 divansitional//EN" "http://www.w3.org/div/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-81">
  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  <link href="${ctx.resource}/css/goals.css" rel="stylesheet">
  <title>人马君</title>
</head>
<body>
  <div class="page-group">
    <div class="page page-current">
      <header class="bar bar-nav fs-header-small">
        <c:choose>
          <c:when test="${not empty scheduleId or back eq 'student'}">
            <a href="${ctx.host}/students/${courseRound.student.id}/rounds/${courseRound.id}${not empty scheduleId ? '?scheduleId=' : ''}${scheduleId}" class="icon icon-left pull-left"></a>
          </c:when>
          <c:otherwise>
            <a href="${ctx.host}/rounds/${courseRound.id}?type=${courseRound.roundCoursewareStatus}" class="icon icon-left pull-left"></a>
          </c:otherwise>
        </c:choose>
        <h1 class="title" style="font-weight: bold;">第${week}周计划</h1>
        <c:if test="${edit}">
          <a href="${ctx.host}/rounds/${courseRound.id}/weekly-plan/${batchId}/edit-exercise<c:choose><c:when test='${not empty scheduleId}'>?scheduleId=${scheduleId}</c:when><c:otherwise><c:if test='${not empty back}'>?back=${back}</c:if></c:otherwise></c:choose>" class="button button-link pull-right"><span style="font-size: .7rem;">编辑</span></a>
        </c:if>
      </header>
      
      <nav class="bar bar-tab" style="padding: 0 .5rem;">
        <div class="tab-item external">
          <c:if test="${week > 1}">
            <a href="${ctx.host}/rounds/${courseRound.id}/weekly-plan/exercise?week=${week-1}<c:choose><c:when test='${not empty scheduleId}'>&scheduleId=${scheduleId}</c:when><c:otherwise><c:if test='${not empty back}'>&back=${back}</c:if></c:otherwise></c:choose>" style="color: #929292">
              <span class="icon icon-left" style="font-size: .7rem;"></span>
              <span class="tab-label" style="font-size: .7rem;">上一周</span>
            </a>
          </c:if>
        </div>
        <div class="tab-item external" style="width: 5%;">
          <c:if test="${!generated and edit}">
            <a href="javascript:void(0);">
              <button class="button button-light batch-link" style="width: 100%; position: static; height: 1.5rem; line-height: 1.5rem; background: #FEDC32; color: #555;">发送课件</button>
            </a>
          </c:if>
        </div>
        <div class="tab-item external">
          <c:if test="${week < maxWeek}">
            <a href="${ctx.host}/rounds/${courseRound.id}/weekly-plan/exercise?week=${week+1}<c:choose><c:when test='${not empty scheduleId}'>&scheduleId=${scheduleId}</c:when><c:otherwise><c:if test='${not empty back}'>&back=${back}</c:if></c:otherwise></c:choose>" style="color: #929292">
              <span class="icon icon-right" style="font-size: .7rem;"></span>
              <span class="tab-label" style="font-size: .7rem;">下一周</span>
            </a>
          </c:if>
        </div>
      </nav>
      
      <div class="content">
        <div style="background-color: #FEDC32;text-align: center;"><small><fmt:formatDate value="${begin}" pattern="yyyy年MM月dd日" />——<fmt:formatDate value="${end}" pattern="yyyy年MM月dd日" /></small></div>
        
        <div class="buttons-tab course-tab">
          <a href="${ctx.host}/rounds/${courseRound.id}/weekly-plan?week=${week}<c:choose><c:when test='${not empty scheduleId}'>&scheduleId=${scheduleId}</c:when><c:otherwise><c:if test='${not empty back}'>&back=${back}</c:if></c:otherwise></c:choose>" class="button">饮食</a>
          <a href="javascript:void(0);" class="button active">运动</a>
        </div>
        
        <div class="text-center" style="background: #eee; padding: 1rem 0;">家庭作业
          <p class="no-margin" style="font-size: .65rem;"><c:if test="${not empty exercise.homeworkFrequency}">家庭作业频率保证一周${exercise.homeworkFrequency}次</c:if></p>
        </div>
        
        <div class="content-block target-course weekly-plan weekly-plan-exercise" style="padding: 0; margin: 0">
          <div class="basic-item">
            <div class="item flex-shrink">LISS低强度恒速有氧训练</div>
            <div class="item">${exercise.liss}</div>
          </div>
          <div class="basic-item">
            <div class="item flex-shrink">HIIT高强度间歇训练</div>
            <div class="item">${exercise.hit}</div>
          </div>
          <div class="basic-item">
            <div class="item flex-shrink">核心训练</div>
            <div class="item">${exercise.core}</div>
          </div>
          <div class="basic-item">
            <div class="item flex-shrink">教练备注</div>
            <div class="item">${exercise.remark}</div>
          </div>
        </div>
        
        <div class="text-center" style="background: #fff190; padding: 1rem 0;">门店训练
          <p class="no-margin" style="font-size: .65rem;"><c:if test="${not empty exercise.scheduleFrequency}">门店训练频率保证一周${exercise.scheduleFrequency}次</c:if></p>
        </div>
        
        <div class="content-block target-course weekly-plan exercise-plan" style="padding: 0; margin: 0">
          <c:forEach begin="1" end="7" var="i">
            <c:set var="day" value="${i}${''}"></c:set>
            <div class="basic-item">
              <div class="item flex-shrink">Day ${i}<br><c:if test="${not empty schedules[day] and not empty courseSchedules[i]}">${courseSchedules[i].coach.name}</c:if></div>
              <div class="item">
                <div class="exercise">
                  <c:forEach var="content" items="${schedules[day].contentList}" varStatus="status">
                    ${status.index eq 0 ? '' : '+'}${content.description}
                  </c:forEach>
                </div>
                <div style="width: 2rem;"><c:if test="${not empty schedules[day] and not empty courseSchedules[i]}"><a href="${ctx.host}/rounds/${courseRound.id}/schedules/${courseSchedules[i].id}" class="alink">详情</a></c:if></div>
              </div>
            </div>
          </c:forEach>
        </div>
      </div>
    </div>
    <%@ include file="/WEB-INF/include/script.jsp"%>
    <d:resource root="${ctx.resource}/build" type="script" src="js/page/courseware/weekly-plan.js" />
    <script type="text/javascript">
      require(['page/courseware/weekly-plan'], function(page) {
        page.init({
            'roundId': '${courseRound.id}',
            'batchId': '${batchId}'
        })
      })
    </script>
  </body>
</html>
